<%@ page language="java" import="java.util.*,myapp.Arithmetic"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>开始做题</title>
</head>
<script type="text/javascript">
	var c = 0;
	var t;
	function timedCount() {
		document.getElementById('txt').value = c;
		c = c + 1;
		t = setTimeout("timedCount()", 1000);
	}
	function startCount() {
		if (t) {
			alert(111);
			return;
		}
		c = document.getElementById('txt').value * 1;
		timedCount();
	}
	function stopCount() {
		clearTimeout(t);
		alert("你共用时："+ c + "秒！");
	}
</script>
<body onload="startCount()">
	<div align="left">
		计时器（秒）： <input type="text" readOnly="true" style="border: 0px"
			id="txt" value="0">
	</div>
	<div align="center">
		<form method="post" action="CheckAnswer.jsp">
			<table border="0">
				<%
					for (int i = 0; i < 5; i++) {
						Arithmetic arith = Arithmetic.getArithmetic();
				%>
				<tr>
					<td><%=arith.getQuestion()%></td>
					<td><input type="text" size="5" name="answer"></td>
					<td><input type="hidden" style="border: 0px" readOnly="true"
						name="arith" value="<%=arith%>"></td>
					<td><input type="hidden" style="border: 0px" readOnly="true"
						name="rightAnswer" value="<%=arith.getAnswer()%>"></td>
				</tr>
				<%
					}
				%>
			</table>

			<input type="submit" onclick="stopCount()" value="提交并查看答案">
		</form>
	</div>
</body>
</html>